#ifndef	global_included
#define	global_included

typedef	__half	half;
typedef	__half2	half2;
uint64_t	prng=time(NULL),init_prng=0;
float	etalr,resnet_scaling=1,gradient;
uint8_t	stage;

static	inline	uint32_t	warp_size(const	uint32_t	m,	const	uint32_t	n) {
    uint32_t	warp=16;
    while((n%(m*warp))&&warp)	warp--;
    if(!warp)	fprintf(stderr,	"warp error: %u %% %u != 0\n",n,m);
    return	warp;
}

cublasHandle_t	handle;

struct	auto_init {
    auto_init() {
        cublasCreate(&handle);
    }
    ~auto_init() {
        cublasDestroy(handle);
    }
} auto_init_instance;

#endif

